import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class test1 {
    public static void main(String[] args) {
        Collection<Student> s = new ArrayList<>();
        Student stu1 = new Student("郑吒",25);
        Student stu2 = new Student("初轩",28);
        Student stu3 = new Student("白罗敷",29);
        ((ArrayList<Student>) s).add(stu1);
        ((ArrayList<Student>) s).add(stu2);
        ((ArrayList<Student>) s).add(stu3);
        for (Student student : s) {
            System.out.println(s);
        }
        Iterator<Student> iterator = s.iterator();
        while (iterator.hasNext()){
            Student next = iterator.next();
            System.out.println(next);
        }
    }
}
